import * as echarts from "../../ec-canvas/echarts";
// 仪表盘
function getOption (data) {
  let color = ['#FFAB91', 'rgb(253,114,71)']
  let option = {
    series: [{ //仪表管
      type: 'gauge',
      startAngle: 200,
      endAngle: -20,
      center: ['50%', '50%'],
      radius: '65%',
      min: 0,
      max: 100,
      splitNumber: 12,
      itemStyle: {
        color: color[0]
      },
      progress: {
        show: true,
        width: 9
      },
      pointer: {
        show: false
      },
      axisLine: {
        lineStyle: {
          width: 9
        }
      },
      axisTick: { // 副刻度线
        show: false,
        distance: -13,
        splitNumber: 5,
        center: ['50%', '0%'],
        length: 2,
        lineStyle: {
          width: 0.7,
          color: 'red'
        }
      },
      splitLine: { // 主刻度线
        show: false,
        distance: -17,
        length: 3,
        lineStyle: {
          width: 1,
          color: '#999'
        }
      },
      axisLabel: { // 仪表盘字体
        distance: -7,
        color: '#999',
        fontSize: 8
      },
      anchor: {
        show: false
      },
      title: {
        show: false
      },
      detail: { //字体设置
        valueAnimation: true,
        width: '2%',
        lineHeight: 40,
        borderRadius: 8,
        offsetCenter: [0, '-12%'],
        fontSize: 15,
        fontWeight: 'bolder',
        formatter: '{value}',
        color: 'auto'
      },
      data: [{
        value: 33.75
      }]
    },
    {
      type: 'gauge',
      center: ['50%', '50%'],
      startAngle: 200,
      endAngle: -20,
      radius: '65%',
      min: 0,
      max: 100,
      itemStyle: {
        color: [
          [
            1,
            new echarts.graphic.LinearGradient(0, 0, 1, 0, [
              {
                offset: 0.1,
                color: "#5cb494",
              },
              {
                offset: 0.35,
                color: "#e1cc5b",
              },
              {
                offset: 0.7,
                color: "#f8b76a",
              },
              {
                offset: 1,
                color: "#ec5145",
              },
            ]),
          ],
        ],
      },
      progress: {
        show: true,
        width: 3 //仪表管道深色宽度
      },
      pointer: {
        show: false
      },
      axisLine: {
        show: false
      },
      axisTick: {
        show: false
      },
      splitLine: {
        show: false
      },
      axisLabel: {
        show: false
      },
      detail: {
        show: false
      },
      data: [{
        value: 33.75
      }]
    }
    ]
  };
  return option;
}
module.exports = {
  //必须在这里暴露接口，以便被外界访问，不然就不能访问
  getOption: getOption,
};
